<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>vfd-cloud - 忘记密码</title>

    <!-- Custom fonts for this template-->
    <link th:href="@{/asserts/vendor/fontawesome-free/css/all.min.css}" rel="stylesheet" type="text/css">
    <link
        href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i"
        rel="stylesheet">

    <!-- Custom styles for this template-->
    <link th:href="@{/asserts/css/sb-admin-2.min.css}" rel="stylesheet">

</head>

<body class="bg-gradient-primary">
    <div class="container">

        <!-- Outer Row -->
        <div class="row justify-content-center">

            <div class="col-xl-10 col-lg-12 col-md-9">

                <div class="card o-hidden border-0 shadow-lg my-5">
                    <div class="card-body p-0">
                        <!-- Nested Row within Card Body -->
                        <div class="row">
                            <div class="col-lg-6 d-none d-lg-block bg-password-image"></div>
                            <div class="col-lg-6">
                                <div class="p-5">
                                    <div class="text-center">
                                        <h1 class="h4 text-gray-900 mb-2">输入你的新密码！</h1>
                                        <p class="mb-4">现在你可以输入你的新密码来重置旧密码！</p>
                                    </div>

                                    <!--提交表单-->
                                    <form class="user" name="user_reset_password" id="user_reset_password" method="post" action="/reset_password">
                                        <div class="form-group">
                                            <input type="password" class="form-control form-control-user"
                                                id="exampleInputPassword" name="exampleInputPassword" aria-describedby="emailHelp"
                                                placeholder="输入新密码">
                                        </div>
                                        <div class="form-group">
                                            <input type="password" class="form-control form-control-user"
                                                   id="exampleRepeatPassword" name="exampleRepeatPassword" aria-describedby="emailHelp"
                                                   placeholder="重复新密码">
                                        </div>
                                        <div class="form-group">
                                            <p style="color: red" th:text="${err}" th:if="${not #strings.isEmpty(err)}"></p>
                                            <p style="color: green" th:text="${msg}" th:if="${not #strings.isEmpty(msg)}"></p>
                                        </div>
                                        <a class="btn btn-primary btn-user btn-block" onclick="document.getElementById('user_reset_password').submit();">
                                            重复密码
                                        </a>
                                        <input type="hidden" name="email" id="email" th:value="${email}">
                                    </form>
                                    <hr>
                                    <div class="text-center">
                                        <a class="small" href="/pages/register">创建一个账户！</a>
                                    </div>
                                    <div class="text-center">
                                        <a class="small" href="/">已经有账户了？登录！</a>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

            </div>

        </div>

    </div>

    <!-- Bootstrap core JavaScript-->
    <script th:src="@{/asserts/vendor/jquery/jquery.min.js}"></script>
    <script th:src="@{/asserts/vendor/bootstrap/js/bootstrap.bundle.min.js}"></script>

    <!-- Core plugin JavaScript-->
    <script th:src="@{/asserts/vendor/jquery-easing/jquery.easing.min.js}"></script>

    <!-- Custom scripts for all pages-->
    <script th:src="@{/asserts/js/sb-admin-2.min.js}"></script>

</body>
<!--<script type="text/javascript">
    function sendMsg() {
        var inputPassword = $.trim($('#exampleInputEmail').val());
        var repeatPassword = $.trim($('#exampleRepeatEmail').val());
        var email = user_reset_password.email.value;
        if (inputPassword != repeatPassword) {
            alert("两次密码不一致");
            return false;
        }
        //向后台发送数据
        $.ajax({
            type: "GET",
            url: "/reset_password",
            async: false,
            contentType: "application/json; charset=utf-8",
            dataType: "text",
            data: {inputPassword:inputPassword,email:email},
            success: function (result) {
                if (result === "success") {       //如果返回数据是notExist
                    alert("修改成功");
                    window.location.href='/';
                } else {
                    alert("修改失败，请稍后重试");
                }
                return false;
            },
            error: function (msg) {
                return false;
            }
        });
    }
</script>-->
</html>